"use strict"

/**
 * 中央政府采购网爬虫
 *  
 */

var Base = require("./base");
var zyzf_spider = new Base();
zyzf_spider.name = "中央政府采购网";
zyzf_spider.contentType = "text";

zyzf_spider.getPageUrl = function(pg) {
    return "http://www.zycg.gov.cn/article/llist?catalog=StockAffiche&page=" + pg;
};

zyzf_spider.getItems = function(data) {
    var items = [];
    var reg = new RegExp("href=\"(.*?)\"[\\s\\S]+?title=\"(.*?)\">","ig");
    var regv;
    while(regv = reg.exec(data)){
        var url = regv[1];
        var title = regv[2];
        var item = [];
        item.title = title;
        item.url = "http://www.zycg.gov.cn" + url;
        console.log(item.url);
        item.source = zyzf_spider.name;
        items.push(item);
    }
    return items;
};

exports = module.exports = zyzf_spider;